package org.loong.crypto.extension.cms.jce;

import java.security.PublicKey;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;

import org.bouncycastle.asn1.cms.IssuerAndSerialNumber;
import org.bouncycastle.cert.jcajce.JcaX509CertificateHolder;
import org.bouncycastle.cms.KeyTransRecipientInfoGenerator;
import org.loong.crypto.service.CryptoService;

public class JceKeyTransRecipientInfoGenerator extends KeyTransRecipientInfoGenerator {

    public JceKeyTransRecipientInfoGenerator(CryptoService cryptoService, X509Certificate recipientCert) throws CertificateEncodingException {
        super(new IssuerAndSerialNumber(new JcaX509CertificateHolder(recipientCert).toASN1Structure()), new JceAsymmetricKeyWrapper(cryptoService, recipientCert));
    }
    
    public JceKeyTransRecipientInfoGenerator(CryptoService cryptoService, byte[] subjectKeyIdentifier, PublicKey publicKey) {
        super(subjectKeyIdentifier, new JceAsymmetricKeyWrapper(cryptoService, publicKey));
    }
}
